<!DOCTYPE html>
<html>
<head>
    <title>edit</title>
    <include file='public/head'></include>
    <style>
        .layui-legend-size{font-size:14px !important;}
        .layui-nopadding{padding:0 !important;}
        .layui-overflow{overflow:auto;}
        .layui-nomargin{margin: 0 !important;}
        .layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}
        .layui-input{height:30px !important; }
        .layui-form-search-item .layui-inline{margin-bottom: 5px;} 
        .layui-form-search-item label{margin-left: 15px;}
        .layui-table-page {padding: 7px 0px 0px;}
        .layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}
    </style>
</head>
<body>
<div class="layui-tab">
    <!-- 表单开始 -->
    <form class="layui-form" id="f">
        <input type="hidden" name="id" value="{$data.id}">
        <div class="layui-form-item">
            <label class="layui-form-label">分类名称</label>
            <div class="layui-input-inline">
                <input type="text" name="title" class="layui-input" required lay-verify="title" placeholder="请输入分类名称" autocomplete="off" value="{$data.title}">
            </div>
        </div>
    </form>
    <!-- 表单结束 -->
</div>
<include file='public/scripts'></include>
<script type="text/javascript">
    var tijiao = function(){
        if($("input[name='title']").val() == ''){
            layer.msg('请输入分类名');
            return false;
        }
        var dara = $("#f").serialize();
        $.ajax({
            url:"{:cmf_plugin_url('community://admin_index/editCategory')}",
            data:dara,
            type:'post',
            success:function(data){console.log(data);
                if (data.code == 200) {
                    layer.msg(data.message,{icon:1,time:1500},function(){
                        parent.layer.closeAll();
                        parent.location.reload(); 
                    });
                } else {
                    layer.msg(data.message,{icon:2,time:1500});
                }
            },
            error:function()
            {
                layer.msg('系统错误',{icon:2,time:1500});
            }
        })
    }
</script>
</body>
</html>